package com.longxi.tianjintianbao.ui.activity.assetscheck;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RadioGroup;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.assetscheck.AssetsDetailAtPresenter;
import com.longxi.tianjintianbao.ui.view.assetscheck.IAssetsDetailAtView;

import butterknife.BindView;

public class AssetsDetailActivity extends BaseActivity<IAssetsDetailAtView, AssetsDetailAtPresenter> implements IAssetsDetailAtView {

    private String TAG = "AssetsDetailActivity";

    @BindView(R.id.rgState)
    RadioGroup mRgState;
    @BindView(R.id.recyclerView)
    RecyclerView mRecyclerView;
    @BindView(R.id.llBtn)
    LinearLayout mLlBtn;
    @BindView(R.id.btnSubmit)
    Button mBtnSubmit;
    @BindView(R.id.btnRepair)
    Button mBtnRepair;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_assets_detail;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
        mPresenter.initSelectImage(mRecyclerView, 3);
    }

    @Override
    public void initListener() {
        super.initListener();
        mPresenter.showBtn(1);
        mRgState.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.rbZc:
                        mPresenter.showBtn(1);
                        break;
                    case R.id.rbYc:
                        mPresenter.showBtn(0);
                        break;
                }
            }
        });
    }

    @Override
    protected AssetsDetailAtPresenter createPresenter() {
        return new AssetsDetailAtPresenter(this);
    }

    @Override
    protected void onDestroy() {
        mPresenter.onDestroy();
        super.onDestroy();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode != RESULT_OK) {
            return;
        }
        mPresenter.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public RadioGroup getRgState() {
        return mRgState;
    }

    @Override
    public RecyclerView getRecyclerView() {
        return mRecyclerView;
    }

    @Override
    public LinearLayout getLlBtn() {
        return mLlBtn;
    }

    @Override
    public Button getBtnSubmit() {
        return mBtnSubmit;
    }

    @Override
    public Button getBtnRepair() {
        return mBtnRepair;
    }
}
